<!--// 기본 js/언어파일 로드 -->
<!--%import("../../tpl/js/editor_common.js")-->
<!--@if($colorset == "white_texteditor" || $colorset == "black_texteditor" || $colorset == "white_text_nohtml" || $colorset == "black_text_nohtml" || $colorset == "white_text_usehtml" || $colorset == "black_text_usehtml")-->
    <!--@if($colorset == "black_texteditor" || $colorset == "black_text_nohtml" || $colorset == "black_text_usehtml")-->
        <!--%import("css/black.css")-->
        {@ $editor_class = "black" }
    <!--@else-->
        <!--%import("css/white.css")-->
    <!--@end-->
    <!--%import("js/xe_interface.js")-->
    <div class="xeTextEditor {$editor_class}">
        <input type="hidden" id="htm_{$editor_sequence}" value="<!--@if($colorset == "white_text_nohtml" || $colorset == "black_text_nohtml")-->n<!--@end--><!--@if($colorset == "white_texteditor" || $colorset == "white_texteditor")-->br<!--@end-->" />
        <textarea id="editor_{$editor_sequence}" style="height:{$editor_height}px;" cols="10" rows="10"></textarea>
    </div>
    <script type="text/javascript">//<![CDATA[
        editorStartTextarea({$editor_sequence}, "{$editor_content_key_name}", "{$editor_primary_key_name}");
    //]]></script>

<!--@else-->

    <!--// 스킨 css 로드 -->
    <!--%import("css/editor.css")-->

    <!--@if($colorset == "black")-->
        <!--%import("css/black.css")-->
        {@ $editor_class = "black" }
    <!--@else-->
        <!--%import("css/white.css")-->
    <!--@end-->

    <!--%import("../../tpl/js/editor.js")-->

    <!-- 자동저장용 폼 -->
    <!--@if($enable_autosave)-->
    <input type="hidden" name="_saved_doc_title" value="{htmlspecialchars($saved_doc->title)}" />
    <input type="hidden" name="_saved_doc_content" value="{htmlspecialchars($saved_doc->content)}" />
    <input type="hidden" name="_saved_doc_message" value="{$lang->msg_load_saved_doc}" />
    <!--@end-->
    <input type="hidden" name="_editor_sequence" value="{$editor_sequence}" />


    <ul class="editorTypeSelector">
        <li class="active" id="use_rich_{$editor_sequence}"><a href="#xeEditor" onclick="editorChangeMode('', '{$editor_sequence}')"><span>{$lang->edit->rich_editor}</span></a></li>

        <!-- HTML 모드 사용 -->
        <!--@if($html_mode)-->
            <!--@if($html_mode)-->
            <li id="use_html_{$editor_sequence}"><a href="#htmlEditor"  onclick="editorChangeMode('html', '{$editor_sequence}')"><span>{$lang->edit->html_editor}</span></a></li>
            <!--@end-->
        <!--@end-->

        <li id="preview_html_{$editor_sequence}"><a href="#htmlEditor" onclick="editorChangeMode('preview','{$editor_sequence}');"><span>{$lang->cmd_preview}</span></a></li>
    </ul>

    <!-- 에디터 -->
    <div id="xeEditor_{$editor_sequence}" class="xeEditor rich">
    <!-- class="xeEditor rich" | class="xeEditor html" -->

        <div id="xeEditorOption_{$editor_sequence}" class="toolBox">

            <!--@if($enable_default_component)-->
            <!-- 기본 컴포넌트 출력 -->
                <ul class="do item">
                    <li class="undo"><button type="button" onclick="editorUnDo(this,'{$editor_sequence}')" id="editor_undo_{$editor_sequence}" title="Ctrl+Z:{$lang->edit->undo}"><span>{$lang->edit->undo}</span></button></li>
                    <li class="redo"><button type="button" onclick="editorReDo(this,'{$editor_sequence}')" id="editor_redo_{$editor_sequence}" title="Ctrl+Y:{$lang->edit->redo}"><span>{$lang->edit->redo}</span></button></li>
                </ul>

                <ul class="type item">
                    <li class="hx">
                        <select onchange="editorChangeHeader(this,'{$editor_sequence}')" id="editor_header_{$editor_sequence}">
                            <option value="">{$lang->edit->header}</option>
                            <!--@foreach($lang->edit->header_list as $key=>$obj)-->
                            <option value="{$key}">{$obj}</option>
                            <!--@end-->
                        </select>
                    </li>
                    <li class="size">
                        <select onchange="editorChangeFontSize(this,'{$editor_sequence}')" id="editor_fontsize_{$editor_sequence}">
                            <option value="" selected="selected">{$lang->edit->fontsize}</option>
                            <option value="1" class="px10">10px</option>
                            <option value="2" class="px13">13px</option>
                            <option value="3" class="px16">16px</option>
                            <option value="4" class="px18">18px</option>
                            <option value="5" class="px24">24px</option>
                            <option value="6" class="px32">32px</option>
                            <option value="7" class="px48">48px</option>
                        </select>
                    </li>
                    <li class="family">
                        <select onchange="editorChangeFontName(this,'{$editor_sequence}')" id="editor_font_{$editor_sequence}">
                            <option value="">{$lang->edit->fontname}</option>
                            <!--@foreach($lang->edit->fontlist as $key=>$obj)-->
                            <option style="font-family:{$key}" value="{$key}">{$obj}</option>
                            <!--@end-->
                        </select>
                    </li>
                </ul>

                <ul class="style item">
                    <li class="bold"><button type="button" title="Ctrl+B:{$lang->edit->help_bold}" id="component_{$editor_sequence}_Bold"><span>{$lang->edit->bold}</span></button></li>
                    <li class="underline"><button type="button" title="Ctrl+U:{$lang->edit->help_underline}" id="component_{$editor_sequence}_Underline"><span>{$lang->edit->underline}</span></button></li>
                    <li class="italic"><button type="button" title="Ctrl+I:{$lang->edit->help_italic}" id="component_{$editor_sequence}_Italic"><span>{$lang->edit->italic}</span></button></li>
                    <li class="strike"><button type="button" title="{$lang->edit->help_strike_through}" id="component_{$editor_sequence}_StrikeThrough"><span>{$lang->edit->strike}</span></button></li>
                    <li class="sup"><button type="button" title="{$lang->edit->help_sup}" id="component_{$editor_sequence}_Superscript"><span>{$lang->edit->sup}</span></button></li>
                    <li class="sub"><button type="button" title="{$lang->edit->help_sub}" id="component_{$editor_sequence}_Subscript"><span>{$lang->edit->sub}</span></button></li>
                    <li class="txColor"><button type="button" title="{$lang->edit->help_fontcolor}" id="component_{$editor_sequence}_colorpicker_text"><span>{$lang->edit->fontcolor}</span></button></li>
                    <li class="bgColor"><button type="button" title="{$lang->edit->help_fontbgcolor}" id="component_{$editor_sequence}_colorpicker_bg"><span>{$lang->edit->fontbgcolor}</span></button></li>
                    <li class="styleRemover"><button type="button" title="Ctrl+D:{$lang->edit->help_remove_format}" id="component_{$editor_sequence}_RemoveFormat"><span>{$lang->edit->remove_format}</span></button></li>
                </ul>

                <ul class="paragraph item">
                    <li class="alignLeft"><button type="button" title="{$lang->edit->help_align_left}" id="component_{$editor_sequence}_JustifyLeft"><span>{$lang->edit->align_left}</span></button></li>
                    <li class="alignCenter"><button type="button" title="{$lang->edit->help_align_center}" id="component_{$editor_sequence}_JustifyCenter"><span>{$lang->edit->align_center}</span></button></li>
                    <li class="alignRight"><button type="button" title="{$lang->edit->help_align_right}" id="component_{$editor_sequence}_JustifyRight"><span>{$lang->edit->align_right}</span></button></li>
                    <li class="alignJustify"><button type="button" title="{$lang->edit->help_align_full}" id="component_{$editor_sequence}_JustifyFull"><span>{$lang->edit->align_justify}</span></button></li>
                    <li class="orderedList"><button type="button" title="{$lang->edit->help_list_number}" id="component_{$editor_sequence}_InsertOrderedList"><span>{$lang->edit->list_number}</span></button></li>
                    <li class="unorderedList"><button type="button" title="{$lang->edit->help_list_bullet}" id="component_{$editor_sequence}_InsertUnorderedList"><span>{$lang->edit->list_bullet}</span></button></li>
                    <li class="outdent"><button type="button" title="{$lang->edit->help_remove_indent}" id="component_{$editor_sequence}_Outdent"><span>{$lang->edit->remove_indent}</span></button></li>
                    <li class="indent"><button type="button" title="{$lang->edit->help_add_indent}" id="component_{$editor_sequence}_Indent"><span>{$lang->edit->add_indent}</span></button></li>
                </ul>

                <ul class="extension1 item">
                    <li class="url"><button type="button" title="Ctrl+L:{$lang->edit->url}" id="component_1_url_link"><span>{$lang->edit->url}</span></button></li>
                    <li class="blockquote"><button type="button" title="{$lang->edit->blockquote}" id="component_1_quotation"><span>{$lang->edit->blockquote}</span></button></li>
                    <li class="table"><button type="button" title="{$lang->edit->table}" id="component_1_table_maker"><span>{$lang->edit->table}</span></button></li>
                    <li class="image"><button type="button" title="{$lang->edit->image}" id="component_1_image_link"><span>{$lang->edit->image}</span></button></li>
                    <li class="movie"><button type="button" title="{$lang->edit->multimedia}" id="component_1_multimedia_link"><span>{$lang->edit->multimedia}</span></button></li>
                    <!--<li class="file"><button type="button" title="File" id="component_1_file"><span>{$lang->edit->multimedia}</span></button></li>-->
                    <li class="emoticon"><button type="button" title="{$lang->edit->emoticon}" id="component_1_emoticon"><span>{$lang->edit->emoticon}</span></button></li>
                </ul>

            <!--@end-->
            <!--@if($enable_component)-->
            <!-- 확장 컴포넌트 출력 -->
                <div class="extension2" id="editorExtension_{$editor_sequence}">
                    <button type="button" class="exButton" title="{$lang->edit->extension}" onclick="showEditorExtension(event,{$editor_sequence})"><span>{$lang->edit->extension}</span></button>
                    <ul id="editor_component_{$editor_sequence}" class="editorComponent">
                        <!--@foreach($component_list as $component_name => $component)-->
                            <!--@if(!in_array($component_name,array('colorpicker_bg','colorpicker_text','emoticon','image_link','multimedia_link','quotation','table_maker','url_link')))-->
                                <li><a href="#" onclick="return false;" id="component_{$editor_sequence}_{$component_name}"><img src="../../components/{$component_name}/component_icon.gif" alt="" /> {$component->title}</a></li>
                            <!--@end-->
                        <!--@end-->
                    </ul>
                </div>
            <!--@end-->


            <!--@if($enable_default_component || $enable_component)-->
            <div class="editorHelp" id="editorHelp_{$editor_sequence}">
                <button type="button" class="helpButton" title="{$lang->edit->help}" onclick="showEditorHelp(event,{$editor_sequence})"><span>{$lang->edit->help}</span></button>
            </div>

            <ul id="helpList_{$editor_sequence}" class="helpList">
                <!--@if(!$_COOKIE['EditorInfo'])-->
                <!-- 에디터 안내 출력 -->
                <li>{$lang->about_dblclick_in_editor}</li>
                <li>{$lang->edit->help_use_paragraph}</li>
                <!--@end-->
                <li>{$lang->edit->help_command}
                    <ul>
                        <li>{$lang->edit->undo} : Ctrl+Z</li>
                        <li>{$lang->edit->redo} : Ctrl+Y</li>
                        <li>{$lang->edit->bold} : Ctrl+B</li>
                        <li>{$lang->edit->underline} : Ctrl+U</li>
                        <li>{$lang->edit->italic} : Ctrl+I</li>
                        <li>{$lang->edit->remove_format} : Ctrl+D</li>
                        <li>{$lang->edit->url} : Ctrl+L</li>
                    </ul>
                </li>
            </ul>
            <!--@end-->
        </div>

        <!--@if($enable_autosave)-->
        <p class="editor_autosaved_message" id="editor_autosaved_message_{$editor_sequence}">&nbsp;</p>
        <!--@end-->

        <!-- 에디터 출력 -->
        <div class="editorBox" id="editorBox" >
            <div class="editorMargin" >
                <iframe id="editor_iframe_{$editor_sequence}" allowTransparency="true" class="richEditor" frameborder="0" height="{$editor_height}" title="Rich Text Editor"></iframe>
                <textarea id="editor_textarea_{$editor_sequence}" class="htmlEditor" style="height:{$editor_height}"  rows="5" cols="20" title="HTML Editor"></textarea>
                <iframe id="editor_preview_{$editor_sequence}" allowTransparency="true" name="editor_preview_{$editor_sequence}" frameborder="0" height="{$editor_height}" style="display:none;" onload="setPreviewHeight({$editor_sequence});"></iframe>
            </div>
        </div>

        <div class="mask" id="xeEditorMask_{$editor_sequence}"></div>

        <!-- 에디터 크기 조절 bar -->
        <div class="textAreaDragIndicator"><button type="button" id="editor_drag_bar_{$editor_sequence}" title="Text Area Resizer"></button></div>

    <!--@if($allow_fileupload)-->
        <!-- 첨부파일 영역 -->
        <!--%import("../../tpl/js/uploader.js",optimized=false)-->
        <!--%import("../../tpl/js/swfupload.js",optimized=false)-->
        <script type="text/javascript">//<![CDATA[
            editorUploadInit(
                {
                    "editorSequence" : {$editor_sequence},
                    "sessionName" : "{session_name()}",
                    "allowedFileSize" : "{$file_config->allowed_filesize}",
                    "allowedFileTypes" : "{$file_config->allowed_filetypes}",
                    "allowedFileTypesDescription" : "{$file_config->allowed_filetypes}",
                    "insertedFiles" : {(int)$files_count},
                    "replaceButtonID" : "swfUploadButton{$editor_sequence}",
                    "fileListAreaID" : "uploaded_file_list_{$editor_sequence}",
                    "previewAreaID" : "preview_uploaded_{$editor_sequence}",
                    "uploaderStatusID" : "uploader_status_{$editor_sequence}"
                }
            );
        //]]></script>
        <!-- 파일 업로드 영역 -->
        <div id="fileUploader_{$editor_sequence}" class="fileUploader">
            <div class="preview {$editor_class}" id="preview_uploaded_{$editor_sequence}"></div>
            <div class="fileListArea {$editor_class}">
                <select id="uploaded_file_list_{$editor_sequence}" multiple="multiple" class="fileList" title="Attached File List"><option></option></select>
            </div>
            <div class="fileUploadControl">
                <span class="button {$editor_class}" id="swfUploadButton{$editor_sequence}"><button type="button">{$lang->edit->upload_file}</button></span>
                <span class="button {$editor_class}"><button type="button" onclick="removeUploadedFile('{$editor_sequence}');return false;">{$lang->edit->delete_selected}</button></span>
                <span class="button {$editor_class}"><button type="button" onclick="insertUploadedFile('{$editor_sequence}');return false;">{$lang->edit->link_file}</button></span>
            </div>
            <div class="file_attach_info" id="uploader_status_{$editor_sequence}">{$upload_status}</div>
        </div>
    <!--@end-->
    </div>

    <!-- 에디터 활성화 -->
    <script type="text/javascript">//<![CDATA[
        var editor_path = "{$editor_path}";
        var auto_saved_msg = "{$lang->msg_auto_saved}";

        <!--@if(!$editor_manual_start)-->

    <!--@if($colorset == "black")-->
        editorStart("{$editor_sequence}", "{$editor_primary_key_name}", "{$editor_content_key_name}", '{$editor_height}' , '#FFF');
    <!--@else-->
        editorStart("{$editor_sequence}", "{$editor_primary_key_name}", "{$editor_content_key_name}", '{$editor_height}' , '#000');
    <!--@end-->
        <!--@end-->
    //]]></script>

<!--@end-->
